package com.baizan.daka.ui.fragment

import android.os.Bundle
import com.baizan.daka.base.BasePageListFragment
import com.baizan.daka.mvp.model.bean.ShowCashBean
import com.baizan.daka.net.BasePageResponse
import com.baizan.daka.ui.adapter.ShowCashAdapter
import com.baizan.daka.ui.contract.ShowCashContract
import com.baizan.daka.ui.presenter.ShowCashPresenter
import kotlinx.android.synthetic.main.frg_base_list.*

class ShowCashFragment : BasePageListFragment<ShowCashPresenter, ShowCashAdapter>(),
    ShowCashContract.View {
    var auditState :String? = null

    companion object {
        fun newInstance(auditState: String) :ShowCashFragment{
            val fragment = ShowCashFragment()
            val bundle = Bundle()
            bundle.putString("auditState", auditState)
            fragment.arguments = bundle
            return fragment
        }
    }

    override fun initData() {
        super.initData()
        auditState = arguments?.getString("auditState")
    }

    override fun onRefresh() {
        presenter?.loadList(mCurrentPageNo,auditState)
    }

    override fun onLoadMore() {
        presenter?.loadList(mCurrentPageNo,auditState)
    }

    override fun initAdapter(): ShowCashAdapter = ShowCashAdapter()

    override fun initPresenter(): ShowCashPresenter = ShowCashPresenter(this)

    override fun initView() {

    }

    override fun start() {
        presenter?.loadList(mCurrentPageNo,auditState)
    }

    override fun loadSuccess(data: BasePageResponse<ShowCashBean>) {
        getDatasSuccess(data)
    }

}